package com.zb.Service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.zb.Service.DictionaryService;
import com.zb.entity.Dictionary;
import com.zb.mapper.DictionaryMapper;

@Component("DictionaryService")
public class DictionaryServiceImpl implements DictionaryService{
	
	@Resource
	private DictionaryMapper dictionaryMapper;

	public int deleteDictionary(int id) {
		// TODO Auto-generated method stub
		return dictionaryMapper.deleteDictionary(id);
	}

	public List<Dictionary> findDictionary(int index,int size) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("index", (index-1)*size);
		params.put("size", size);
		return dictionaryMapper.findDictionary(params);
	}

	public List<Dictionary> findDictionaryChild(int id) {
		// TODO Auto-generated method stub
		return dictionaryMapper.findDictionaryChild(id);
	}

	public Dictionary getDictionaryById(int id) {
		// TODO Auto-generated method stub
		return dictionaryMapper.getDictionaryById(id);
	}

	public int saveDictionary(Dictionary dictionary) {
		// TODO Auto-generated method stub
		return dictionaryMapper.saveDictionary(dictionary);
	}

	public int saveDictionaryChild(Dictionary dictionary) {
		// TODO Auto-generated method stub
		return dictionaryMapper.saveDictionaryChild(dictionary);
	}

	public int updateDictionary(Dictionary dictionary) {
		// TODO Auto-generated method stub
		return dictionaryMapper.updateDictionary(dictionary);
	}

	public int count() {
		// TODO Auto-generated method stub
		return dictionaryMapper.count();
	}
	
}